﻿using Microsoft.Practices.Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DeviceMgtModule.Views
{
    /// <summary>
    /// View_DeviceManagement.xaml 的交互逻辑
    /// </summary>
    public partial class View_DeviceManagement : UserControl
    {
        #region 构造函数

        public View_DeviceManagement(IRegionManager regionManager)
        {
            InitializeComponent();

            this.DataContext = new ViewModels.ViewModel_DeviceManagement(regionManager);
        }

        #endregion

        #region 事件

        private void Layout_Error(object sender, ValidationErrorEventArgs e)
        {
            if (e.Action == ValidationErrorEventAction.Added)
            {
                (e.OriginalSource as Control).Background = new SolidColorBrush(Colors.Yellow);
            }

            if (e.Action == ValidationErrorEventAction.Removed)
            {
                (e.OriginalSource as Control).Background = new SolidColorBrush(Colors.White);
            }
        }

        #endregion
    }
}
